import sys, traceback, IPython.Shell
sys.path.append('/usr/share/python-support/pydb')

def hook(type, value, tb):
    '''Enable postmortem debugging'''
    shell = IPython.Shell.IPShellEmbed()
    traceback.print_exception(type, value, tb)
    print
    shell.IP.debugger(true)

def set_trace():
    '''Enable breakpoint debugging'''
    from IPython.Debugger import Tracer
    from IPython.excolors import ExceptionColors
    ExceptionColors.active_scheme_name = 'Linux'
    set_trace = Tracer('Linux')
    set_trace()

sys.excepthook = hook
